package com.spike.servlet;

import com.spike.model.User;
import com.spike.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/registAjax")
public class RegistAjaxServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String phone = req.getParameter("phone");
        System.out.println(phone);
//        查询phone是否被注册过
        UserService userService = new UserService();
        User user = userService.findByPhone(phone);
        if (user != null) {//已经注册过
            resp.getWriter().write("500");
        }

    }
}
